//
//  HomeViewController.m
//  NoNameAmazing
//
//  Created by 刘金壮 on 17/6/24.
//  Copyright © 2017年 北京执行力科技有限公司. All rights reserved.
//

#import "HomeViewController.h"
#import "SchoolNewsController.h"
#import "SchoolNoticeController.h"
#import "SchoolNoticeController.h"
#import "HomeHeaderView.h"
#import "HeroSegmentView.h"
#import "SDCycleScrollView.h"
@interface HomeViewController ()
@property (nonatomic ,strong) HomeHeaderView *headView;
@property (nonatomic ,strong) HeroSegmentView * heroView;
@property(nonatomic,strong)SDCycleScrollView *sycleScrollView;
@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.headView];
    SchoolNewsController *introduction = [[SchoolNewsController alloc]initWithNibName:@"SchoolNewsController" bundle:nil];
    introduction.title = @"校园新闻";
    SchoolNoticeController *product = [[SchoolNoticeController alloc]initWithNibName:@"SchoolNoticeController" bundle:nil];
    product.title = @"校园公告";
    SchoolNoticeController *address = [[SchoolNoticeController alloc]initWithNibName:@"SchoolNoticeController" bundle:nil];
    address.title = @"校园通知";
    _heroView = [[HeroSegmentView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.headView.frame)+10, kScreen_Width, kScreen_Height -54 -64)];
    
    [self.view addSubview:_heroView];
    [_heroView setViewControllers:@[introduction, product, address] owner:self];
    UIView *segView = [_heroView topControlViewWithFrame:CGRectMake(0, CGRectGetMaxY(self.headView.frame)-44, kScreen_Width, 44) defaultColor:UIColorFromRGB(0x333333) selectedColor:UIColorFromRGB(0x1A7BE5)];
    [self.view addSubview:segView];
    _sycleScrollView = [[SDCycleScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 125)];
    _sycleScrollView.currentPageDotImage = [UIImage imageNamed:@"point_black-1"];
    _sycleScrollView.pageDotImage = [UIImage imageNamed:@"point_black_pre-1"];
    _sycleScrollView.autoScroll = YES;
    [_headView addSubview:_sycleScrollView];
    _sycleScrollView.currentPageDotColor = UIColorFromRGB(0xe74d26);
    _sycleScrollView.localizationImageNamesGroup = @[@"hy1",@"hy3",@"hy4"];
    
}

#pragma mark - 懒加载 -
- (HomeHeaderView *)headView{
    if (!_headView) {
        _headView = [[NSBundle mainBundle] loadNibNamed:@"HomeHeaderView" owner:self options:nil].lastObject;
        
    }
    return _headView;
}





@end
